#pragma once

namespace LSH
{
namespace GUI
{

class EventArgs;

class SlotFunctorBase
{
public:
    virtual ~SlotFunctorBase(void) {}
public:
    virtual bool operator ()(const EventArgs& agrs) = 0;
};

template<typename T>
class MemberFunctionSlot : public SlotFunctorBase
{
public:
    typedef bool (T::*MemberFunctionType)(const EventArgs& args);
public:
    MemberFunctionSlot(MemberFunctionType func, T* obj):_function(func), _object(obj)
    {
    }
    virtual ~MemberFunctionSlot(void)
    {
    }

    virtual bool operator ()(const EventArgs& agrs)
    {
        (_object->*_function)(agrs);
    }
protected:
    MemberFunctionType _function;
    T* _object;
};

} // GUI
} // LSH
